/**
 *    Copyright 2012 Geensoft S.A.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
package ar.com.greensoft.neo.model;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.envers.Audited;

import ar.com.greensoft.neo.model.constraint.PersonaJuridicaContraints;
import ar.com.greensoft.neo.model.references.RazonSocial;

/**
 * Simple JavaBean domain object that represents a Legal Person in the
 * Customer Relationship Management System.  
 *  
 * @author Jorge E. Villaverde
 * @since 04/01/2012
 * @version 1.0.0
 */
@Entity
@Table(name="persona_juridica")
@NamedQueries({
	@NamedQuery(name=PersonaJuridica.FIND_ALL_QUERY_NAME, query="SELECT c FROM PersonaJuridica c ORDER BY c.cuip"),
	@NamedQuery(name=PersonaJuridica.FIND_BY_CUIP_QUERY_NAME, query="SELECT c FROM PersonaJuridica c WHERE c.cuip = :cuip"),
	@NamedQuery(name=PersonaJuridica.COUNT_QUERY_NAME,    query="SELECT COUNT(c) FROM PersonaJuridica c")
})
@PersonaJuridicaContraints
@Audited
public class PersonaJuridica extends Persona { 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String FIND_ALL_QUERY_NAME = "PersonaJuridica.findAll";
	public static final String FIND_BY_CUIP_QUERY_NAME = "PersonaJuridica.findByCuip";
	public static final String COUNT_QUERY_NAME = "PersonaJuridica.count";
	
	@NotNull
	@Size(min=1, max=70)
	private String nombre;
		
	@Enumerated(EnumType.STRING)
	private RazonSocial razonSocial;

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public RazonSocial getRazonSocial() {
		return razonSocial;
	}

	public void setRazonSocial(RazonSocial razonSocial) {
		this.razonSocial = razonSocial;
	}
	
}
